package com.homework;

/**
 * @author yulian174
 * @version 1.0
 */
public class Person {
    private String name;
    private int age;
    private String job;

    public Person(String name, int age, String job) {
        this.name = name;
        this.age = age;
        this.job = job;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public String getJob() {
        return job;
    }

}

class Per {
    public Person[] arr(Person[] arr) {
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - i - 1; j++) {
                if (arr[j].getAge() > arr[j + 1].getAge()) {
                    Person temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }
        return arr;
    }

    public void arr1(Person[] arr) {
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i].getName() + " ");
            System.out.print(arr[i].getAge() + " ");
            System.out.print(arr[i].getJob() + " ");
            System.out.println();
        }
    }
}
